package com.gitee.wsl.ext.collection

inline fun <R,reified T : R> Collection<R>.addIfNeeded(creator: () -> T) =
    if (none { T::class.isInstance(it) }) toMutableList().apply { add(0, creator()) } else this